import { Router, Route, Link, BrowserRouter, Switch } from 'react-router-dom'
import React, { useRef } from 'react';
import { useEffect, useState } from 'react';
import { useFullscreen } from 'ahooks'
import { Layout, Menu, Breadcrumb, Button, Space, Card, Image } from 'antd';
import UserInfo from './userInfo'
import ExamInfo from './examInfo'
import QuestionInfo from './questionInfo'
export default () => {
    const [pictureUrl, setPictureUrl] = useState("")
    const ref = useRef();
    const [isFullscreen, { setFull, exitFull, toggleFull }] = useFullscreen(ref);

    const fullScreen = () => {
        if (document.documentElement.RequestFullScreen) {
            document.documentElement.RequestFullScreen();
        }
        //兼容火狐
        console.log(document.documentElement.mozRequestFullScreen)
        if (document.documentElement.mozRequestFullScreen) {
            document.documentElement.mozRequestFullScreen();
        }
        //兼容谷歌等可以webkitRequestFullScreen也可以webkitRequestFullscreen
        if (document.documentElement.webkitRequestFullScreen) {
            document.documentElement.webkitRequestFullScreen();
        }
        //兼容IE,只能写msRequestFullscreen
        if (document.documentElement.msRequestFullscreen) {
            document.documentElement.msRequestFullscreen();
        }
    }
    const notFullScreen = () => {
        if (document.exitFullScreen) {
            document.exitFullscreen()
        }
        //兼容火狐
        console.log(document.mozExitFullScreen)
        if (document.mozCancelFullScreen) {
            document.mozCancelFullScreen()
        }
        //兼容谷歌等
        if (document.webkitExitFullscreen) {
            document.webkitExitFullscreen()
        }
        //兼容IE
        if (document.msExitFullscreen) {
            document.msExitFullscreen()
        }
    }

    //页面加载时全屏
    useEffect(() => {
        fullScreen();
    }, [])


    return (

        <Space>

            <UserInfo />
            <QuestionInfo
                pictureUrl={pictureUrl}
                setPictureUrl={setPictureUrl}
            />
        </Space>

    )
}